home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / ctlib100.zip / INSTALL.LZH / CTFIELDS.INT < prev    next >
Text File  |  1996-10-12  |  4KB  |  113 lines

  1. {**************************************************************************}
  2. {*  BitSoft Development, L.L.C.                                           *}
  3. {*  Copyright (C) 1995, 1996 BitSoft Development, L.L.C.                  *}
  4. {*  All rights reserved.                                                  *}
  5. {*  Field types unit                                                      *}
  6. {*  Version 1.2.2                                                         *}
  7. {**************************************************************************}
  8.  
  9. unit ctFields;
  10.  
  11. {$X+}
  12.  
  13. interface
  14.  
  15. uses Objects,
  16.      ctTypes, ctCollec;
  17.  
  18. type
  19.   FieldTypes = (ftUnknown, ftChar, ftString, ftPChar, ftMemo,
  20.                 ftBoolean, ftDate, ftTime,
  21.                 ftByte, ftWord, ftShortInt, ftInteger, ftLongInt, ftComp,
  22.                 ftReal, ftSingle, ftDouble, ftExtended,
  23.                 ftPString, ftPointer,
  24.                 ftRecord, ftObject, ftObjectID);
  25.  
  26. type
  27.   PField = ^TField;
  28.   TField = object(TObject)
  29.       Name : PFieldName;
  30.       FieldType : FieldTypes;
  31.       Length : Word;
  32.       Decimals : Byte;
  33.     constructor Init (AName : TFieldName; AFieldType : FieldTypes;
  34.                       ALength : Word; NumberOfDecimals : Byte);
  35.     constructor Load (var S : TStream);
  36.     destructor  Done; virtual;
  37.     function Copy : PField; virtual;
  38.     function Size : Word; virtual;
  39.     procedure Store (var S : TStream); virtual;
  40.   end; { TField }
  41.  
  42. type
  43.   PFieldStructure = ^TFieldStructure;
  44.   TFieldStructure = object(TCollection)
  45.     function Copy : PFieldStructure; virtual;
  46.     function FieldDecimals (AField : Integer) : Byte;
  47.     function FieldLength (AField : Integer) : Word;
  48.     function FieldName (AField : Integer) : PFieldName;
  49.     function FieldType (AField : Integer) : FieldTypes;
  50.     function Length : LongInt; virtual;
  51.     procedure ShowInfo (var Device : Text); virtual;
  52.     function Size : Word; virtual;
  53.   end;  {  TFieldStructure }
  54.  
  55.  
  56. function NewObjectField (Name : TFieldName; ObjectSize : Word) : PField;
  57.  
  58. function NewObjectIDField : PField;
  59.  
  60. function NewCharField (Name : TFieldName) : PField;
  61.  
  62. function NewStringField (Name : TFieldName; MaxLen : Byte) : PField;
  63.  
  64. function NewPCharField (Name : TFieldName; MaxLen : Word) : PField;
  65.  
  66. function NewPStringField (Name : TFieldName; MaxLen : Word) : PField;
  67.  
  68. function NewBooleanField (Name : TFieldName) : PField;
  69.  
  70. function NewDateField (Name : TFieldName) : PField;
  71.  
  72. function NewPointerField (Name : TFieldName) : PField;
  73.  
  74. function NewTimeField (Name : TFieldName) : PField;
  75.  
  76. function NewByteField (Name : TFieldName) : PField;
  77.  
  78. function NewShortIntField (Name : TFieldName) : PField;
  79.  
  80. function NewWordField (Name : TFieldName) : PField;
  81.  
  82. function NewIntegerField (Name : TFieldName) : PField;
  83.  
  84. function NewLongIntField (Name : TFieldName) : PField;
  85.  
  86. function NewCompField (Name : TFieldName) : PField;
  87.  
  88. function NewRealField (Name : TFieldName) : PField;
  89.  
  90. function NewSingleField (Name : TFieldName) : PField;
  91.  
  92. function NewDoubleField (Name : TFieldName) : PField;
  93.  
  94. function NewExtendedField (Name : TFieldName) : PField;
  95.  
  96. procedure RegisterFields;
  97.  
  98. const
  99.   RField : TStreamRec = (
  100.     ObjType : idField;
  101.     VmtLink : Ofs(TypeOf(TField)^);
  102.     Load    : @TField.Load;
  103.     Store   : @TField.Store);
  104.  
  105.   RFieldStructure : TStreamRec = (
  106.     ObjType : idFieldStructure;
  107.     VmtLink : Ofs(TypeOf(TFieldStructure)^);
  108.     Load    : @TFieldStructure.Load;
  109.     Store   : @TFieldStructure.Store);
  110.  
  111. implementation
  112. end.
  113.